package org.zfes.snowier.cloud.zbss.pmp.router.service.pub;




import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.core.util.ZAssert;
import org.zfes.snowier.web.controller.BaseController;

import org.zfes.snowier.auth.shiro.util.SecurityUtil;
import org.zfes.snowier.cloud.zbss.pmp.service.IPmpCloudMemberService;

@Controller ("org.zfes.snowier.cloud.zbss.pmp.router.service.pub.pmpCloudMemberController")
@RequestMapping("/pmp/service/pub/pmpCloudMember")
public class PmpCloudMemberController extends BaseController {

	
	@Autowired
	private IPmpCloudMemberService pmpCloudMemberService;
	
	
	
	 @RequestMapping(value="/loadPmpCloudMemberDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	    public @ResponseBody  Object loadPmpCloudMemberDataSet(@RequestParam Map<String,Object> params){
		    DataSet dataSet=  pmpCloudMemberService.loadPmpCloudMemberDataSet(params);
		    return ajaxQuery("dataSet", dataSet);
	    }
	 
	 
	 
    @RequestMapping(value="/changepwd", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object  changepwd( String newPassword, String repeatNewPassword, String oldpassword) {
		ZAssert.hasText(newPassword, "请输入新密码");
		ZAssert.hasText(oldpassword, "请再次输入旧密码");
    	ZAssert.equals(newPassword, repeatNewPassword, "两次密码不一致");
    	pmpCloudMemberService.changepwd(SecurityUtil.getUserName().get(), newPassword, oldpassword);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
    @RequestMapping(value="/setUserLogo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object  setUserLogo(Long id,String userLogo) {
    	ZAssert.notNull(id, "请选择用户");
    	ZAssert.hasText(userLogo, "请选择userLogo");
    	pmpCloudMemberService.setUserLogo(id,userLogo);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
    
}